From 5195f97d356ee76a7206112ae0cb62c4d3c532d8 Mon Sep 17 00:00:00 2001
From: Brandon <brandon.abr@hotmail.com>
Date: Thu, 13 May 2021 22:11:36 -0500
Subject: [PATCH] [Keyboard] Added smAllice (#12543)

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
---
 keyboards/smallice/config.h                  | 90 ++++++++++++++++++++
 keyboards/smallice/info.json                 | 12 +++
 keyboards/smallice/keymaps/default/keymap.c  | 32 +++++++
 keyboards/smallice/keymaps/default/readme.md |  3 +
 keyboards/smallice/keymaps/via/keymap.c      | 44 ++++++++++
 keyboards/smallice/keymaps/via/readme.md     |  3 +
 keyboards/smallice/keymaps/via/rules.mk      |  2 +
 keyboards/smallice/readme.md                 | 21 +++++
 keyboards/smallice/rules.mk                  | 22 +++++
 keyboards/smallice/smallice.c                | 17 ++++
 keyboards/smallice/smallice.h                | 40 +++++++++
 11 files changed, 286 insertions(+)
 create mode 100644 keyboards/smallice/config.h
 create mode 100644 keyboards/smallice/info.json
 create mode 100644 keyboards/smallice/keymaps/default/keymap.c
 create mode 100644 keyboards/smallice/keymaps/default/readme.md
 create mode 100644 keyboards/smallice/keymaps/via/keymap.c
 create mode 100644 keyboards/smallice/keymaps/via/readme.md
 create mode 100644 keyboards/smallice/keymaps/via/rules.mk
 create mode 100644 keyboards/smallice/readme.md
 create mode 100644 keyboards/smallice/rules.mk
 create mode 100644 keyboards/smallice/smallice.c
 create mode 100644 keyboards/smallice/smallice.h

diff --git a/keyboards/smallice/config.h b/keyboards/smallice/config.h
new file mode 100644
index 0000000000..551c3cefd2
--- /dev/null
+++ b/keyboards/smallice/config.h
@@ -0,0 +1,90 @@
+/*
+Copyright 2020 quark
+
+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    0x514B // QK Quark
+#define PRODUCT_ID   0x5341 // SA smAllice
+#define DEVICE_VER   0x0001
+#define MANUFACTURER quark
+#define PRODUCT      smAllice
+
+/* key matrix size */
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 15
+
+/*
+ * 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)
+ *
+ */
+#define MATRIX_ROW_PINS { B0, B6, B5, B4 }
+#define MATRIX_COL_PINS { C7, C6, F7, F6, F5, F4, F1, D4, D6, D7, D0, D1, D2, D3, D5 }
+#define UNUSED_PINS { E6, F0 }
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+#define RGB_DI_PIN B7
+#ifdef RGB_DI_PIN
+#    define RGBLED_NUM 12
+#    define RGBLIGHT_HUE_STEP 8
+#    define RGBLIGHT_SAT_STEP 8
+#    define RGBLIGHT_VAL_STEP 8
+#    define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
+#    define RGBLIGHT_SLEEP  /* If defined, the RGB lighting will be switched off when the host goes to sleep */
+/*== all animations enable ==*/
+#    define RGBLIGHT_ANIMATIONS
+/*== or choose animations ==*/
+//#    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
+/*== customize breathing effect ==*/
+/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
+//#    define RGBLIGHT_BREATHE_TABLE_SIZE 256      // 256(default) or 128 or 64
+/*==== use exp() and sin() ====*/
+//#    define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85  // 1 to 2.7
+//#    define RGBLIGHT_EFFECT_BREATHE_MAX    255   // 0 to 255
+#endif
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCE 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
+//#define MATRIX_HAS_GHOST
+
+/* disable these deprecated features by default */
+#define NO_ACTION_MACRO
+#define NO_ACTION_FUNCTION
+
+/* Bootmagic Lite key configuration */
+#define BOOTMAGIC_LITE_ROW 0
+#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/smallice/info.json b/keyboards/smallice/info.json
new file mode 100644
index 0000000000..979791db2b
--- /dev/null
+++ b/keyboards/smallice/info.json
@@ -0,0 +1,12 @@
+{
+    "keyboard_name": "smAllice", 
+    "url": "https://keyhive.xyz/shop/smallice", 
+    "maintainer": "https://github.com/Armastardo", 
+    "width": 16.75, 
+    "height": 4, 
+    "layouts": {
+        "LAYOUT": {
+            "layout": [{"label":"V+", "x":0.5, "y":0}, {"label":"Tab", "x":1.75, "y":0}, {"label":"Q", "x":2.75, "y":0}, {"label":"W", "x":3.75, "y":0}, {"label":"E", "x":4.75, "y":0}, {"label":"R", "x":5.75, "y":0}, {"label":"T", "x":6.75, "y":0}, {"label":"Y", "x":8.25, "y":0}, {"label":"U", "x":9.25, "y":0}, {"label":"I", "x":10.25, "y":0}, {"label":"O", "x":11.25, "y":0}, {"label":"P", "x":12.25, "y":0}, {"label":"[ {", "x":13.25, "y":0}, {"label":"] }", "x":14.25, "y":0}, {"label":"Bcsp", "x":15.25, "y":0}, {"label":"V-", "x":0.25, "y":1}, {"label":"Caps", "x":1.5, "y":1, "w":1.25}, {"label":"A", "x":2.75, "y":1}, {"label":"S", "x":3.75, "y":1}, {"label":"D", "x":4.75, "y":1}, {"label":"F", "x":5.75, "y":1}, {"label":"G", "x":6.75, "y":1}, {"label":"H", "x":8.75, "y":1}, {"label":"J", "x":9.75, "y":1}, {"label":"K", "x":10.75, "y":1}, {"label":"L", "x":11.75, "y":1}, {"label":": ;", "x":12.75, "y":1}, {"label":", \"", "x":13.75, "y":1}, {"label":"Enter", "x":14.75, "y":1, "w":1.75}, {"label":"V-", "x":0, "y":2}, {"label":"Shift", "x":1.25, "y":2, "w":1.75}, {"label":"Z", "x":3, "y":2}, {"label":"X", "x":4, "y":2}, {"label":"C", "x":5, "y":2}, {"label":"V", "x":6, "y":2}, {"label":"B", "x":7, "y":2}, {"label":"B", "x":8.5, "y":2}, {"label":"N", "x":9.5, "y":2}, {"label":"M", "x":10.5, "y":2}, {"label":"<", "x":11.5, "y":2}, {"label":">", "x":12.5, "y":2}, {"label":"Shift", "x":13.5, "y":2, "w":1.25}, {"label":"Up", "x":14.75, "y":2}, {"label":"?", "x":15.75, "y":2}, {"label":"Ctrl", "x":1.25, "y":3}, {"label":"Alt", "x":3, "y":3, "w":1.25}, {"x":4.25, "y":3, "w":2}, {"label":"Win", "x":6.25, "y":3}, {"x":9.5, "y":3, "w":2.75}, {"label":"Fn", "x":12.25, "y":3}, {"label":"left", "x":13.75, "y":3}, {"label":"down", "x":14.75, "y":3}, {"label":"right", "x":15.75, "y":3}]
+        }
+    }
+}
\ No newline at end of file
diff --git a/keyboards/smallice/keymaps/default/keymap.c b/keyboards/smallice/keymaps/default/keymap.c
new file mode 100644
index 0000000000..d4a5fad42b
--- /dev/null
+++ b/keyboards/smallice/keymaps/default/keymap.c
@@ -0,0 +1,32 @@
+/* Copyright 2020 quark
+ *
+ * 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] = {
+    /* Base */
+    [0] = LAYOUT(
+        KC_ESC,  KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,     KC_P,   KC_LBRC, KC_RBRC, KC_BSPC,
+        KC_VOLU, 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_VOLD, KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_B,    KC_N,    KC_M,    KC_COMM,  KC_DOT, KC_RSFT, KC_UP,   KC_SLSH,
+                 KC_LCTRL,         KC_LALT,          KC_SPC,  KC_LWIN,          KC_SPC,           MO(1),            KC_LEFT, KC_DOWN, KC_RIGHT
+    ),
+    [1] = LAYOUT(
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+                 _______,          _______,          _______, _______,          _______,          _______,          _______, _______, _______
+    ),
+};
diff --git a/keyboards/smallice/keymaps/default/readme.md b/keyboards/smallice/keymaps/default/readme.md
new file mode 100644
index 0000000000..e0c573662c
--- /dev/null
+++ b/keyboards/smallice/keymaps/default/readme.md
@@ -0,0 +1,3 @@
+# The default keymap for smAllice
+
+![smAllice](https://i.imgur.com/OngGf9n.png)
\ No newline at end of file
diff --git a/keyboards/smallice/keymaps/via/keymap.c b/keyboards/smallice/keymaps/via/keymap.c
new file mode 100644
index 0000000000..d9f5d58d65
--- /dev/null
+++ b/keyboards/smallice/keymaps/via/keymap.c
@@ -0,0 +1,44 @@
+/* Copyright 2020 quark
+ *
+ * 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] = {
+    /* Base */
+    [0] = LAYOUT(
+        KC_ESC,  KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,     KC_P,   KC_LBRC, KC_RBRC, KC_BSPC,
+        KC_VOLU, 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_VOLD, KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_B,    KC_N,    KC_M,    KC_COMM,  KC_DOT, KC_RSFT, KC_UP,   KC_SLSH,
+                 KC_LCTRL,         KC_LALT,          KC_SPC,  KC_LWIN,          KC_SPC,           MO(1),            KC_LEFT, KC_DOWN, KC_RIGHT
+    ),
+    [1] = LAYOUT(
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+                 _______,          _______,          _______, _______,          _______,          _______,          _______, _______, _______
+    ),
+    [2] = LAYOUT(
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+                 _______,          _______,          _______, _______,          _______,          _______,          _______, _______, _______
+    ),
+    [3] = LAYOUT(
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
+        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+                 _______,          _______,          _______, _______,          _______,          _______,          _______, _______, _______
+    ),
+};
diff --git a/keyboards/smallice/keymaps/via/readme.md b/keyboards/smallice/keymaps/via/readme.md
new file mode 100644
index 0000000000..af98163f94
--- /dev/null
+++ b/keyboards/smallice/keymaps/via/readme.md
@@ -0,0 +1,3 @@
+# VIA keymap for smAllice
+
+![smAllice](https://i.imgur.com/OngGf9n.png)
\ No newline at end of file
diff --git a/keyboards/smallice/keymaps/via/rules.mk b/keyboards/smallice/keymaps/via/rules.mk
new file mode 100644
index 0000000000..43061db1dd
--- /dev/null
+++ b/keyboards/smallice/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/smallice/readme.md b/keyboards/smallice/readme.md
new file mode 100644
index 0000000000..70ac44cf74
--- /dev/null
+++ b/keyboards/smallice/readme.md
@@ -0,0 +1,21 @@
+# smAllice
+
+![smAllice](https://i.imgur.com/HAiJnnK.png)
+
+A 40% alice-like keyboard with an arrow cluster.
+
+* Keyboard Maintainer: [Brandon Beltran](https://github.com/armastardo)
+* Hardware Supported: smAllice PCB
+* Hardware Availability: [KeyHive](http://keyhive.xyz/)
+
+Make example for this keyboard (after setting up your build environment):
+
+    make smallice:default
+
+### Flash
+
+- Plug in
+- Press reset button
+- Flash using QMK Toolbox or dfu-util (`make smallice:<keymap>: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).
diff --git a/keyboards/smallice/rules.mk b/keyboards/smallice/rules.mk
new file mode 100644
index 0000000000..ef4ccf32fb
--- /dev/null
+++ b/keyboards/smallice/rules.mk
@@ -0,0 +1,22 @@
+# 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 = no            # USB Nkey Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = yes        # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no       # Enable Bluetooth
+AUDIO_ENABLE = no           # Audio output
diff --git a/keyboards/smallice/smallice.c b/keyboards/smallice/smallice.c
new file mode 100644
index 0000000000..c7d65e27ab
--- /dev/null
+++ b/keyboards/smallice/smallice.c
@@ -0,0 +1,17 @@
+/* Copyright 2020 armastardo / quark
+ *
+ * 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 "smallice.h"
diff --git a/keyboards/smallice/smallice.h b/keyboards/smallice/smallice.h
new file mode 100644
index 0000000000..12d4356795
--- /dev/null
+++ b/keyboards/smallice/smallice.h
@@ -0,0 +1,40 @@
+/* Copyright 2020 armastardo / quark
+ *
+ * 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"
+
+/* 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( \
+	K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
+	K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112,       K114, \
+	K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \
+	      K301,       K303,       K305, K306,       K308,       K310,       K312, K313, K314  \
+) \
+{ \
+	{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011,  K012,  K013,  K014 }, \
+	{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111,  K112,  KC_NO, K114 }, \
+	{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211,  K212,  K213,  K214 }, \
+	{ KC_NO, K301,  KC_NO, K303,  KC_NO, K305,  K306,  KC_NO, K308,  KC_NO, K310,  KC_NO, K312,  K313,  K314 }  \
+}