From a49bdd2659186e6ea0c888e91229260d7c849a2d Mon Sep 17 00:00:00 2001
From: emlah <88459992+emlah@users.noreply.github.com>
Date: Sat, 13 Aug 2022 15:47:39 -0400
Subject: [PATCH] add BAMFK-4 (#17985)

* add BAMFK-4
---
 keyboards/keebio/bamfk4/bamfk4.c              |  37 +++++
 keyboards/keebio/bamfk4/bamfk4.h              |  12 ++
 keyboards/keebio/bamfk4/config.h              | 146 ++++++++++++++++++
 keyboards/keebio/bamfk4/info.json             |  20 +++
 .../keebio/bamfk4/keymaps/default/keymap.c    |  18 +++
 keyboards/keebio/bamfk4/keymaps/via/keymap.c  |  15 ++
 keyboards/keebio/bamfk4/keymaps/via/rules.mk  |   3 +
 keyboards/keebio/bamfk4/rules.mk              |  23 +++
 8 files changed, 274 insertions(+)
 create mode 100644 keyboards/keebio/bamfk4/bamfk4.c
 create mode 100644 keyboards/keebio/bamfk4/bamfk4.h
 create mode 100644 keyboards/keebio/bamfk4/config.h
 create mode 100644 keyboards/keebio/bamfk4/info.json
 create mode 100644 keyboards/keebio/bamfk4/keymaps/default/keymap.c
 create mode 100644 keyboards/keebio/bamfk4/keymaps/via/keymap.c
 create mode 100644 keyboards/keebio/bamfk4/keymaps/via/rules.mk
 create mode 100644 keyboards/keebio/bamfk4/rules.mk

diff --git a/keyboards/keebio/bamfk4/bamfk4.c b/keyboards/keebio/bamfk4/bamfk4.c
new file mode 100644
index 0000000000..6a382bfaf6
--- /dev/null
+++ b/keyboards/keebio/bamfk4/bamfk4.c
@@ -0,0 +1,37 @@
+// Copyright 2022 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "bamfk4.h"
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = { {
+    // Key Matrix to LED Index
+    { NO_LED, NO_LED, NO_LED, NO_LED },
+}, {
+    // LED Index to Physical Position
+    //through switch
+    { 26.6, 10 }, { 4.3, 10 }, { 3.8, 49.3 }, { 23.3, 49.3 },
+    { 69.4, 49.3 }, { 68.9, 10 }, { 90.6, 10 }, { 89.5, 49.3 },
+    { 134, 49.3 }, { 132.9, 10 }, { 155.7, 10 }, { 155.1, 49.3 },
+    { 199.6, 49.3 }, { 199.6, 10 }, { 219.1, 10 }, { 219.1, 49.3 },
+
+    //underglow
+    { 218, 62.2 }, { 188.7, 62.2 }, { 159.5, 62.2 }, { 123.7, 62.2 }, //bottom right
+    { 100.3, 62.2 }, { 59.1, 62.2 }, { 35.3, 62.2 }, { 5.4, 62.2 }, //bottom left
+    { 6, 6.4 }, { 35.3, 6.4 }, { 59.1, 6.4 }, { 100.3, 6.4 }, //top left
+    { 123.7, 6.4 }, { 159.5, 6.4 }, { 188.7, 6.4 }, { 218, 6.4 } //top right
+}, {
+    // LED Index to Flag
+    4, 4, 4, 4, 
+    4, 4, 4, 4, 
+    4, 4, 4, 4,
+    4, 4, 4, 4, 
+    2, 2, 2, 2,
+    2, 2, 2, 2,
+    2, 2, 2, 2,
+    2, 2, 2, 2 
+} };
+
+
+
+#endif
\ No newline at end of file
diff --git a/keyboards/keebio/bamfk4/bamfk4.h b/keyboards/keebio/bamfk4/bamfk4.h
new file mode 100644
index 0000000000..0bdc2f602f
--- /dev/null
+++ b/keyboards/keebio/bamfk4/bamfk4.h
@@ -0,0 +1,12 @@
+// Copyright 2022 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT( \
+    k00, k01, k02, k03 \
+) { \
+    { k00, k01, k02, k03 }, \
+}
diff --git a/keyboards/keebio/bamfk4/config.h b/keyboards/keebio/bamfk4/config.h
new file mode 100644
index 0000000000..b18b94da10
--- /dev/null
+++ b/keyboards/keebio/bamfk4/config.h
@@ -0,0 +1,146 @@
+// Copyright 2022 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "config_common.h"
+
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 4
+
+/*
+ * Keyboard Matrix Assignments
+ */
+#define MATRIX_ROW_PINS { F0 }
+#define MATRIX_COL_PINS { E6, D5, B6, B7 }
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+#define RGB_DI_PIN D3
+#ifdef RGB_DI_PIN
+#    define RGBLED_NUM 32
+#    define RGBLIGHT_HUE_STEP 8
+#    define RGBLIGHT_SAT_STEP 8
+#    define RGBLIGHT_VAL_STEP 8
+#    define RGBLIGHT_LIMIT_VAL 120 /* The maximum brightness level */
+#    define RGBLIGHT_SLEEP         /* If defined, the RGB lighting will be switched off when the host goes to sleep */
+/*== enabled 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
+#    define RGBLIGHT_EFFECT_TWINKLE
+#    define RGBLIGHT_DEFAULT_VAL 120
+#    define RGBLIGHT_DEFAULT_MODE (RGBLIGHT_MODE_RAINBOW_SWIRL + 2)
+// RGB Matrix
+//#    ifdef RGB_MATRIX_ENABLE
+#        define ENABLE_RGB_MATRIX_ALPHAS_MODS
+#        define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+#        define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+#        define ENABLE_RGB_MATRIX_BREATHING
+#        define ENABLE_RGB_MATRIX_BAND_SAT
+#        define ENABLE_RGB_MATRIX_BAND_VAL
+#        define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+#        define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+#        define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+#        define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+#        define ENABLE_RGB_MATRIX_CYCLE_ALL
+#        define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+#        define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
+#        define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+#        define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
+#        define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#        define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
+#        define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
+#        define ENABLE_RGB_MATRIX_DUAL_BEACON
+#        define ENABLE_RGB_MATRIX_RAINBOW_BEACON
+#        define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
+#        define ENABLE_RGB_MATRIX_TYPING_HEATMAP
+#        define ENABLE_RGB_MATRIX_DIGITAL_RAIN
+// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+#        define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+#        define ENABLE_RGB_MATRIX_SPLASH
+#        define ENABLE_RGB_MATRIX_MULTISPLASH
+#        define ENABLE_RGB_MATRIX_SOLID_SPLASH
+#        define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
+#        define RGB_MATRIX_MAXIMUM_BRIGHTNESS 160
+#        define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
+#        define DRIVER_LED_TOTAL RGBLED_NUM
+#        define RGB_DISABLE_WHEN_USB_SUSPENDED
+#        define RGB_MATRIX_KEYPRESSES
+//#    endif
+#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
+
+/* 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
+
+/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
+ * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
+ */
+//#define GRAVE_ESC_CTRL_OVERRIDE
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
+
+/*
+ * Feature disable options
+ *  These options are also useful to firmware size reduction.
+ */
+
+/* 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
+
+/* Bootmagic Lite key configuration */
+//#define BOOTMAGIC_LITE_ROW 0
+//#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/keebio/bamfk4/info.json b/keyboards/keebio/bamfk4/info.json
new file mode 100644
index 0000000000..1d04f4348b
--- /dev/null
+++ b/keyboards/keebio/bamfk4/info.json
@@ -0,0 +1,20 @@
+{
+    "keyboard_name": "BAMFK-4",
+    "url": "https://keeb.io",
+    "maintainer": "nooges",
+    "usb": {
+        "vid": "0xCB10",
+        "pid": "0x1114",
+        "device_version": "0.0.1"
+    },
+    "layouts": {
+        "LAYOUT": {
+            "layout": [
+                {"x": 0, "y": 0, "w": 2, "h": 2},
+                {"x": 2, "y": 0, "w": 2, "h": 2},
+                {"x": 4, "y": 0, "w": 2, "h": 2},
+                {"x": 6, "y": 0, "w": 2, "h": 2}
+            ]
+        }
+    }
+}
diff --git a/keyboards/keebio/bamfk4/keymaps/default/keymap.c b/keyboards/keebio/bamfk4/keymaps/default/keymap.c
new file mode 100644
index 0000000000..960c436da3
--- /dev/null
+++ b/keyboards/keebio/bamfk4/keymaps/default/keymap.c
@@ -0,0 +1,18 @@
+// Copyright 2021 Danny Nguyen (@nooges)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include QMK_KEYBOARD_H
+
+// Defines names for use in layer keycodes and the keymap
+enum layer_names {
+    _MAIN,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [_MAIN] = LAYOUT(
+        KC_A,
+        KC_B,
+        KC_C,
+        KC_D
+    )
+};
\ No newline at end of file
diff --git a/keyboards/keebio/bamfk4/keymaps/via/keymap.c b/keyboards/keebio/bamfk4/keymaps/via/keymap.c
new file mode 100644
index 0000000000..454d9c6d62
--- /dev/null
+++ b/keyboards/keebio/bamfk4/keymaps/via/keymap.c
@@ -0,0 +1,15 @@
+#include QMK_KEYBOARD_H
+
+// Defines names for use in layer keycodes and the keymap
+enum layer_names {
+    _MAIN,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [_MAIN] = LAYOUT(
+        KC_A,
+        KC_B,
+        KC_C,
+        KC_D
+    )
+};
\ No newline at end of file
diff --git a/keyboards/keebio/bamfk4/keymaps/via/rules.mk b/keyboards/keebio/bamfk4/keymaps/via/rules.mk
new file mode 100644
index 0000000000..25da8e7e85
--- /dev/null
+++ b/keyboards/keebio/bamfk4/keymaps/via/rules.mk
@@ -0,0 +1,3 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
+MOUSEKEY_ENABLE = yes
\ No newline at end of file
diff --git a/keyboards/keebio/bamfk4/rules.mk b/keyboards/keebio/bamfk4/rules.mk
new file mode 100644
index 0000000000..b8ae254413
--- /dev/null
+++ b/keyboards/keebio/bamfk4/rules.mk
@@ -0,0 +1,23 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
+
+# Build Options
+#   change yes to no to disable
+#
+BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
+MOUSEKEY_ENABLE = no        # Mouse keys
+EXTRAKEY_ENABLE = yes       # Audio control and System control
+CONSOLE_ENABLE = yes        # Console for debug
+COMMAND_ENABLE = no         # Commands for debug and configuration
+NKRO_ENABLE = no            # Enable N-Key Rollover
+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no       # Enable keyboard RGB underglow
+AUDIO_ENABLE = no          # Audio output
+ENCODER_ENABLE = no
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = WS2812
+
+LTO_ENABLE = yes